#ifndef __WF_OBJECT_H__
#define __WF_OBJECT_H__

#include "Vertex.h"

#pragma once


class CEdge
{
public:
	int v0, v1;

public:
	CEdge(): v0(0), v1(0) {}
	~CEdge() {}
	CEdge( int t0, int t1 ) { Set( t0, t1 ); }
	void	Set( int t0, int t1 ) { v0 = t0; v1 = t1; }
};

typedef loop_list<CEdge *> edge_list;


class CWFObject
{
private:
	vertex_list		m_vecVertices;
	edge_list		m_vecEdges;

	int			CountElements( FILE *fp, int& nv, int& ne );
	void		Clear();
	char		*GetValidLine(FILE *file);
	int			ReadVertices (FILE *file);
	int			AddVertex(double x, double y);
	int			ReadEdges(FILE *fp);
	int			AddEdge(int v0, int v1);

public:
	CWFObject();
	~CWFObject();

	int			NumVertices();
	int			NumEdges();

	CVertex		*GetVertexAt( int i ) { return m_vecVertices.at(i); }
	CEdge		*GetEdgeAt( int i ) { return m_vecEdges.at(i); }
	vertex_list	&GetVertexList()	{ return m_vecVertices; }
	edge_list	&GetEdgeList()	{ return m_vecEdges; }

	int			Load(char *filename);
	int			Load(FILE *fp);
	//int Save( char *filename );
}; 

#endif	// __WF_OBJECT_H__
